import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.util.List;
/**
 * Write a description of class House here.
 * 
 * @author Andre de Zwart
 */
public class House extends Actor
{
    private boolean hasVictim = false;
    
    /**
     * Act - do whatever the House wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        // Add your action code here.
    }  
    
    /**
     * Add a victim to this house
     */
    public void setVictim(){
        hasVictim = true;
        showVictim();
    }
    
    /**
     * Remove a victim from this house
     */
    public void unsetVictim(){
        hasVictim = false;
        hideVictim();
    }
    
    /**
     * Does this house have a victim
     */
    public boolean getVictim(){
        if(hasVictim){
            return true;
        }else{
            return false;
        }
    }
    
    /**
     * Show the victim on top of the house
     */
    private void showVictim(){
        Victim v1 = new Victim();        
        getWorld().addObject(v1, this.getX() + 10, this.getY() - 25);        
    }
    
    /**
     * Hide the victim on the house
     */
    private void hideVictim(){
        Actor victim = getOneIntersectingObject(Victim.class);
        
        if(victim != null){
            getWorld().removeObject(victim);
        }
    }
}